//
//  NSObject+FCUrlPathGet.h
//  Pods
//
//  Created by WJC on 2020/12/30.
//

#import <Foundation/Foundation.h>
#import "NSObject+KVCChangeType.h"
#import "WJCDefine.h"
#import "FCCGetCurrentVcTool.h"
#import "FCUrlLocalModel.h"
#import "NSObject+localDataBaseCache.h"
#import "AFNetworkActivityIndicatorManager.h"
#import "AFHTTPSessionManager.h"
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSUInteger, INFIUploadType) {
    INFIUploadTypeImg,
    INFIUploadTypeJPGImg,
    INFIUploadTypeVideo,
    INFIUploadTypeVoice,
    INFIUploadTypeOther
};
@interface upLoadModel:NSObject
///上传类型
@property (nonatomic,assign) INFIUploadType uploadType;
///图片  ,INFIUploadTypeImg下有效
@property (nonatomic,strong) UIImage *img;
///上传data,如果有data优先去data,没data 去取filepath
@property (nonatomic,strong) NSData *data;
///要上传的本地路径
@property (nonatomic,strong) NSString *filePath;
    ///文件格式,设置uploadtype的时候自填充
@property (nonatomic,strong) NSString *ext;
    ///文件上传type,设置uploadtype的时候自填充
@property (nonatomic,strong) NSString *mimeType;
@end
@interface NSObject (FCUrlPathGet)
    //按钮配置url访问

typedef void (^requestSuccetionActionBlock)(id obj);
    //按钮配置url访问的区间域名
@property (nonatomic, strong) NSString *urlPath;
    //返回数据中的class数据转换若多层则用,隔开
@property (nonatomic, strong) NSString *requestStrMJClass;
//转换的模型
@property (nonatomic, strong) NSObject *mjClass;
        /// 按钮配置rul访问传值(目前只支持post)
@property (nonatomic,strong) NSDictionary *requestData;
        /// 是否过滤报错,否是,api请求报错降不在弹窗
@property (nonatomic,assign) bool filterError;

@property (nonatomic,assign) bool printSuccess;
@property (nonatomic,assign) bool notJson;
//用于区分不同地方点击位置,类似tag,与path无关
@property (nonatomic,assign) NSInteger indexGet;
    /// POst请求的头部
@property (nonatomic,strong) NSDictionary *requestHeaderData;
-(void)getRequestWithBlock:(requestSuccetionActionBlock)success;
    /// 请求回调
    /// @param success 成功回调
-(void)postRequestWithBlock:(requestSuccetionActionBlock)success;
///优先走缓存请求
-(void)postPriorityRequestWithBlock:(requestSuccetionActionBlock)success;
-(void)postRequestWithBlock:(requestSuccetionActionBlock)success andFail:(requestSuccetionActionBlock)fail;
    /// 带本地缓存回调
    /// @param localSuccess 本地缓存回调
    /// @param success api请求回调
    /// @param fail 失败回调
-(void)postRequestWithlocalSuccessBlock:(requestSuccetionActionBlock)localSuccess Block:(requestSuccetionActionBlock)success andFail:(requestSuccetionActionBlock)fail;

/// 表单访问
/// @param success 成功回调
/// @param fail 失败回调
-(void)formDataRequestWithBlock:(requestSuccetionActionBlock)success andFail:(nonnull requestSuccetionActionBlock)fail;

/// 表单,带缓存
/// @param localSuccess 本地回调
/// @param success api请求回调
/// @param fail 失败回调
-(void)formDataRequestWithlocalSuccessBlock:(requestSuccetionActionBlock)localSuccess Block:(requestSuccetionActionBlock)success andFail:(nonnull requestSuccetionActionBlock)fail;
-(void)uploadFileWithFile:(id)file andFileType:(INFIUploadType)type Block:(requestSuccetionActionBlock)success;
-(void)uploadFileWithFiles:(NSMutableArray<upLoadModel*>*)files Block:(requestSuccetionActionBlock)success;

/// 本地数据通配连表字段
/// 例:group模型id关联user模型groupId
/// ---- id = user.groupId
+(NSDictionary *)wjc_localDataBaseUnion;
-(AFHTTPSessionManager *)getAFManager;
/*!
 @method
 @abstract   移除所有观察的keypath
 */
//- (void)removeAllObserverdKeyPath;

@end

NS_ASSUME_NONNULL_END
